﻿using System;
using EkStudio.com.common.dbconn;
using System.Collections.Generic;
using EkStudio.com.common.unit;

namespace EkStudio.com.ui.form.AllowLogin
{
    public partial class AllowForm : DevExpress.XtraEditors.XtraForm
    {

        private bool allow = true;
        private HttpConnectUnit db = null;
        public AllowForm(bool _allow,HttpConnectUnit dbconn)
        {
            InitializeComponent();
            allow = _allow;
            db = dbconn;
            if (_allow)
            {
                LimitComboBox.SelectedIndex = 0;
            }
            else
            {
                LimitComboBox.SelectedIndex = 1;
            }
        }

        private void SubButton_Click(object sender, EventArgs e)
        {
            if (LimitComboBox.SelectedText == "允许登录")
            {
                Dictionary<string, string> param = new Dictionary<string, string>();
                param.Add("allow", "是");
                db.PostHttp(ProjectUtil.HTTP_ALLOW_LOGIN_URL, param, "");
            }else if(LimitComboBox.SelectedText == "禁止登录")
            {
                Dictionary<string, string> param = new Dictionary<string, string>();
                param.Add("allow", "否");
                db.PostHttp(ProjectUtil.HTTP_ALLOW_LOGIN_URL, param, "");
            }
            
        }

        private void CanButton_Click(object sender, EventArgs e)
        {

        }
    }
}